/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('dyiotapi', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model DoIotChgBindOrUnBindRequest {
  iccid?: string(name='Iccid'),
  imei?: string(name='Imei'),
  midChannelId?: string(name='MidChannelId'),
  newImei?: string(name='NewImei'),
  opionType?: string(name='OpionType'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotChgBindOrUnBindResponseBody = {
  code?: string(name='Code'),
  iotModBind?: {
    isModSuccess?: boolean(name='IsModSuccess'),
  }(name='IotModBind'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DoIotChgBindOrUnBindResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotChgBindOrUnBindResponseBody(name='body'),
}

async function doIotChgBindOrUnBindWithOptions(request: DoIotChgBindOrUnBindRequest, runtime: Util.RuntimeOptions): DoIotChgBindOrUnBindResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.imei)) {
    query['Imei'] = request.imei;
  }
  if (!Util.isUnset(request.midChannelId)) {
    query['MidChannelId'] = request.midChannelId;
  }
  if (!Util.isUnset(request.newImei)) {
    query['NewImei'] = request.newImei;
  }
  if (!Util.isUnset(request.opionType)) {
    query['OpionType'] = request.opionType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotChgBindOrUnBind',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotChgBindOrUnBind(request: DoIotChgBindOrUnBindRequest): DoIotChgBindOrUnBindResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotChgBindOrUnBindWithOptions(request, runtime);
}

model DoIotIsImeiExistRequest {
  imei?: string(name='Imei'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotIsImeiExistResponseBody = {
  code?: string(name='Code'),
  iotImeiExist?: {
    isImeiExist?: boolean(name='IsImeiExist'),
  }(name='IotImeiExist'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DoIotIsImeiExistResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotIsImeiExistResponseBody(name='body'),
}

async function doIotIsImeiExistWithOptions(request: DoIotIsImeiExistRequest, runtime: Util.RuntimeOptions): DoIotIsImeiExistResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.imei)) {
    query['Imei'] = request.imei;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotIsImeiExist',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotIsImeiExist(request: DoIotIsImeiExistRequest): DoIotIsImeiExistResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotIsImeiExistWithOptions(request, runtime);
}

model DoIotPostImeiRequest {
  comments?: string(name='Comments'),
  deviceType?: string(name='DeviceType'),
  imei?: string(name='Imei'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotPostImeiResponseBody = {
  code?: string(name='Code'),
  iotPostImei?: {
    isPostSuccess?: boolean(name='IsPostSuccess'),
  }(name='IotPostImei'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DoIotPostImeiResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotPostImeiResponseBody(name='body'),
}

async function doIotPostImeiWithOptions(request: DoIotPostImeiRequest, runtime: Util.RuntimeOptions): DoIotPostImeiResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.comments)) {
    query['Comments'] = request.comments;
  }
  if (!Util.isUnset(request.deviceType)) {
    query['DeviceType'] = request.deviceType;
  }
  if (!Util.isUnset(request.imei)) {
    query['Imei'] = request.imei;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotPostImei',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotPostImei(request: DoIotPostImeiRequest): DoIotPostImeiResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotPostImeiWithOptions(request, runtime);
}

model DoIotSetAbsoluteRemindConfigRequest {
  bizId?: string(name='BizId'),
  bizType?: string(name='BizType'),
  configInfo?: string(name='ConfigInfo'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotSetAbsoluteRemindConfigResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DoIotSetAbsoluteRemindConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotSetAbsoluteRemindConfigResponseBody(name='body'),
}

async function doIotSetAbsoluteRemindConfigWithOptions(request: DoIotSetAbsoluteRemindConfigRequest, runtime: Util.RuntimeOptions): DoIotSetAbsoluteRemindConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizId)) {
    query['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.bizType)) {
    query['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.configInfo)) {
    query['ConfigInfo'] = request.configInfo;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotSetAbsoluteRemindConfig',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotSetAbsoluteRemindConfig(request: DoIotSetAbsoluteRemindConfigRequest): DoIotSetAbsoluteRemindConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotSetAbsoluteRemindConfigWithOptions(request, runtime);
}

model DoIotSetRemindConfigRequest {
  bizId?: string(name='BizId'),
  bizType?: string(name='BizType'),
  configInfo?: string(name='ConfigInfo'),
  operationType?: string(name='OperationType'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotSetRemindConfigResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DoIotSetRemindConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotSetRemindConfigResponseBody(name='body'),
}

async function doIotSetRemindConfigWithOptions(request: DoIotSetRemindConfigRequest, runtime: Util.RuntimeOptions): DoIotSetRemindConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizId)) {
    query['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.bizType)) {
    query['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.configInfo)) {
    query['ConfigInfo'] = request.configInfo;
  }
  if (!Util.isUnset(request.operationType)) {
    query['OperationType'] = request.operationType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotSetRemindConfig',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotSetRemindConfig(request: DoIotSetRemindConfigRequest): DoIotSetRemindConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotSetRemindConfigWithOptions(request, runtime);
}

model DoIotUnbindResumeRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotUnbindResumeResponseBody = {
  code?: string(name='Code'),
  data?: boolean(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DoIotUnbindResumeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotUnbindResumeResponseBody(name='body'),
}

async function doIotUnbindResumeWithOptions(request: DoIotUnbindResumeRequest, runtime: Util.RuntimeOptions): DoIotUnbindResumeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotUnbindResume',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotUnbindResume(request: DoIotUnbindResumeRequest): DoIotUnbindResumeResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotUnbindResumeWithOptions(request, runtime);
}

model DoIotUserStopResumeRequest {
  iccid?: string(name='Iccid'),
  optionType?: string(name='OptionType'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DoIotUserStopResumeResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    controlResult?: boolean(name='ControlResult'),
  }(name='Result'),
}

model DoIotUserStopResumeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoIotUserStopResumeResponseBody(name='body'),
}

async function doIotUserStopResumeWithOptions(request: DoIotUserStopResumeRequest, runtime: Util.RuntimeOptions): DoIotUserStopResumeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.optionType)) {
    query['OptionType'] = request.optionType;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoIotUserStopResume',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doIotUserStopResume(request: DoIotUserStopResumeRequest): DoIotUserStopResumeResponse {
  var runtime = new Util.RuntimeOptions{};
  return doIotUserStopResumeWithOptions(request, runtime);
}

model DoSendIotSmsRequest {
  ownerId?: long(name='OwnerId'),
  phoneNumbers?: string(name='PhoneNumbers'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  signName?: string(name='SignName'),
  templateCode?: string(name='TemplateCode'),
  templateParam?: string(name='TemplateParam'),
}

model DoSendIotSmsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model DoSendIotSmsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DoSendIotSmsResponseBody(name='body'),
}

async function doSendIotSmsWithOptions(request: DoSendIotSmsRequest, runtime: Util.RuntimeOptions): DoSendIotSmsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.phoneNumbers)) {
    query['PhoneNumbers'] = request.phoneNumbers;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.signName)) {
    query['SignName'] = request.signName;
  }
  if (!Util.isUnset(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!Util.isUnset(request.templateParam)) {
    query['TemplateParam'] = request.templateParam;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DoSendIotSms',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function doSendIotSms(request: DoSendIotSmsRequest): DoSendIotSmsResponse {
  var runtime = new Util.RuntimeOptions{};
  return doSendIotSmsWithOptions(request, runtime);
}

model QueryCardFlowInfoRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryCardFlowInfoResponseBody = {
  cardFlowInfos?: {
    cardFlowInfo?: [ 
    {
      expireDate?: string(name='ExpireDate'),
      flowResource?: long(name='FlowResource'),
      flowUsed?: long(name='FlowUsed'),
      resName?: string(name='ResName'),
      resourceType?: string(name='ResourceType'),
      restOfFlow?: long(name='RestOfFlow'),
      smsUsed?: long(name='SmsUsed'),
      validDate?: string(name='ValidDate'),
      voiceTotal?: long(name='VoiceTotal'),
      voiceUsed?: long(name='VoiceUsed'),
    }
  ](name='CardFlowInfo')
  }(name='CardFlowInfos'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model QueryCardFlowInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryCardFlowInfoResponseBody(name='body'),
}

async function queryCardFlowInfoWithOptions(request: QueryCardFlowInfoRequest, runtime: Util.RuntimeOptions): QueryCardFlowInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryCardFlowInfo',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCardFlowInfo(request: QueryCardFlowInfoRequest): QueryCardFlowInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCardFlowInfoWithOptions(request, runtime);
}

model QueryCardHistoryFlowInfoRequest {
  endTime?: string(name='EndTime'),
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  startTime?: string(name='StartTime'),
}

model QueryCardHistoryFlowInfoResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      curValue?: long(name='CurValue'),
      dayUsageList?: [ 
        {
          day?: int32(name='Day'),
          value?: long(name='Value'),
        }
      ](name='DayUsageList'),
      month?: long(name='Month'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryCardHistoryFlowInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryCardHistoryFlowInfoResponseBody(name='body'),
}

async function queryCardHistoryFlowInfoWithOptions(request: QueryCardHistoryFlowInfoRequest, runtime: Util.RuntimeOptions): QueryCardHistoryFlowInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryCardHistoryFlowInfo',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCardHistoryFlowInfo(request: QueryCardHistoryFlowInfoRequest): QueryCardHistoryFlowInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCardHistoryFlowInfoWithOptions(request, runtime);
}

model QueryCardInfoRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryCardInfoResponseBody = {
  cardInfo?: {
    firstActiveTime?: string(name='FirstActiveTime'),
    gprsStatus?: string(name='GprsStatus'),
    iccid?: string(name='Iccid'),
    imsi?: string(name='Imsi'),
    msisdn?: string(name='Msisdn'),
    openTime?: string(name='OpenTime'),
    smsStatus?: string(name='SmsStatus'),
    voiceStatus?: string(name='VoiceStatus'),
  }(name='CardInfo'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model QueryCardInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryCardInfoResponseBody(name='body'),
}

async function queryCardInfoWithOptions(request: QueryCardInfoRequest, runtime: Util.RuntimeOptions): QueryCardInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryCardInfo',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCardInfo(request: QueryCardInfoRequest): QueryCardInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCardInfoWithOptions(request, runtime);
}

model QueryCardStatusRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryCardStatusResponseBody = {
  cardStatus?: {
    iccid?: string(name='Iccid'),
    msisdn?: string(name='Msisdn'),
    userStatus?: string(name='UserStatus'),
  }(name='CardStatus'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model QueryCardStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryCardStatusResponseBody(name='body'),
}

async function queryCardStatusWithOptions(request: QueryCardStatusRequest, runtime: Util.RuntimeOptions): QueryCardStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryCardStatus',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCardStatus(request: QueryCardStatusRequest): QueryCardStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCardStatusWithOptions(request, runtime);
}

model QueryCardsInfoRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryCardsInfoResponseBody = {
  cardsInfo?: [ 
    {
      firstActiveTime?: string(name='FirstActiveTime'),
      gprsStatus?: string(name='GprsStatus'),
      iccid?: string(name='Iccid'),
      imsi?: string(name='Imsi'),
      msisdn?: string(name='Msisdn'),
      openTime?: string(name='OpenTime'),
      smsStatus?: string(name='SmsStatus'),
      voiceStatus?: string(name='VoiceStatus'),
    }
  ](name='CardsInfo'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model QueryCardsInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryCardsInfoResponseBody(name='body'),
}

async function queryCardsInfoWithOptions(request: QueryCardsInfoRequest, runtime: Util.RuntimeOptions): QueryCardsInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryCardsInfo',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCardsInfo(request: QueryCardsInfoRequest): QueryCardsInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCardsInfoWithOptions(request, runtime);
}

model QueryIotCardOfferDtlRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryIotCardOfferDtlResponseBody = {
  cardOfferDetail?: {
    detail?: [ 
    {
      effectiveTime?: string(name='EffectiveTime'),
      expireTime?: string(name='ExpireTime'),
      offerId?: string(name='OfferId'),
      offerName?: string(name='OfferName'),
      orderTime?: string(name='OrderTime'),
    }
  ](name='detail')
  }(name='CardOfferDetail'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model QueryIotCardOfferDtlResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryIotCardOfferDtlResponseBody(name='body'),
}

async function queryIotCardOfferDtlWithOptions(request: QueryIotCardOfferDtlRequest, runtime: Util.RuntimeOptions): QueryIotCardOfferDtlResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryIotCardOfferDtl',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryIotCardOfferDtl(request: QueryIotCardOfferDtlRequest): QueryIotCardOfferDtlResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryIotCardOfferDtlWithOptions(request, runtime);
}

model QueryPersonalInfoRequest {
  iccid?: string(name='Iccid'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryPersonalInfoResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model QueryPersonalInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryPersonalInfoResponseBody(name='body'),
}

async function queryPersonalInfoWithOptions(request: QueryPersonalInfoRequest, runtime: Util.RuntimeOptions): QueryPersonalInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryPersonalInfo',
    version = '2017-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryPersonalInfo(request: QueryPersonalInfoRequest): QueryPersonalInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryPersonalInfoWithOptions(request, runtime);
}

